package client;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

import model.Auto;

class ClientMain {
	public static void main(String[] args) {
		Socket server = null;
		try {

			for (int i = 0; i < 150; i++) {

				server = new Socket("10.18.2.93", 50000);
				ObjectInputStream in = null;
				ObjectOutputStream out = new ObjectOutputStream(
						server.getOutputStream());

				System.out.println("Sende...");
				Auto auto = new Auto("Mercedes");
				out.writeObject(auto);
				out.flush();

				System.out.println("Empfange...");
				if (in == null) {
					in = new ObjectInputStream(server.getInputStream());
				}
				Auto resultAuto = (Auto) in.readObject();
				System.out.println("Resultat: " + resultAuto);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (server != null)
				try {
					server.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}
}